package www.lagou.app;

import org.junit.Test;
import www.lagou.dao.PhoneDao;
import www.lagou.entity.Phone;

import java.sql.SQLException;
import java.util.List;

/**
 * PhoneDao的测试类
 */
public class TestPhoneDao {
    private PhoneDao phoneDao = new PhoneDao();

    @Test
    public void testFindPhoneByPriceAndDate() throws SQLException {
        double price = 2000.0;
        String prodate = "2019-01-01";
        List<Phone> phones = phoneDao.findPhoneByPriceAndDate(price, prodate);
        if (phones ==null || phones.size() == 0)
            System.out.println("查询结果为空！");
        else{
            for (Phone p: phones) {
                System.out.println(p);
            }
        }
    }

    @Test
    public void testFindPhoneByColor() throws SQLException {
        String color = "白色";
        List<Phone> phones = phoneDao.findPhoneByColor(color);
        if (phones ==null || phones.size() == 0)
            System.out.println("查询结果为空！");
        else{
            for (Phone p: phones) {
                System.out.println(p);
            }
        }
    }
}
